/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package EA_Model.IEC61970.Generation.Production.impl;

import EA_Model.IEC61970.Core.impl.CurveImpl;

import EA_Model.IEC61970.Domain.WaterLevel;

import EA_Model.IEC61970.Generation.Production.ProductionPackage;
import EA_Model.IEC61970.Generation.Production.TargetLevelSchedule;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Target Level Schedule</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link EA_Model.IEC61970.Generation.Production.impl.TargetLevelScheduleImpl#getHighLevelLimit <em>High Level Limit</em>}</li>
 *   <li>{@link EA_Model.IEC61970.Generation.Production.impl.TargetLevelScheduleImpl#getLowLevelLimit <em>Low Level Limit</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class TargetLevelScheduleImpl extends CurveImpl implements TargetLevelSchedule {
	/**
	 * The cached value of the '{@link #getHighLevelLimit() <em>High Level Limit</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getHighLevelLimit()
	 * @generated
	 * @ordered
	 */
	protected WaterLevel highLevelLimit;

	/**
	 * The cached value of the '{@link #getLowLevelLimit() <em>Low Level Limit</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getLowLevelLimit()
	 * @generated
	 * @ordered
	 */
	protected WaterLevel lowLevelLimit;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected TargetLevelScheduleImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return ProductionPackage.Literals.TARGET_LEVEL_SCHEDULE;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public WaterLevel getHighLevelLimit() {
		if (highLevelLimit != null && highLevelLimit.eIsProxy()) {
			InternalEObject oldHighLevelLimit = (InternalEObject)highLevelLimit;
			highLevelLimit = (WaterLevel)eResolveProxy(oldHighLevelLimit);
			if (highLevelLimit != oldHighLevelLimit) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, ProductionPackage.TARGET_LEVEL_SCHEDULE__HIGH_LEVEL_LIMIT, oldHighLevelLimit, highLevelLimit));
			}
		}
		return highLevelLimit;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public WaterLevel basicGetHighLevelLimit() {
		return highLevelLimit;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setHighLevelLimit(WaterLevel newHighLevelLimit) {
		WaterLevel oldHighLevelLimit = highLevelLimit;
		highLevelLimit = newHighLevelLimit;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ProductionPackage.TARGET_LEVEL_SCHEDULE__HIGH_LEVEL_LIMIT, oldHighLevelLimit, highLevelLimit));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public WaterLevel getLowLevelLimit() {
		if (lowLevelLimit != null && lowLevelLimit.eIsProxy()) {
			InternalEObject oldLowLevelLimit = (InternalEObject)lowLevelLimit;
			lowLevelLimit = (WaterLevel)eResolveProxy(oldLowLevelLimit);
			if (lowLevelLimit != oldLowLevelLimit) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, ProductionPackage.TARGET_LEVEL_SCHEDULE__LOW_LEVEL_LIMIT, oldLowLevelLimit, lowLevelLimit));
			}
		}
		return lowLevelLimit;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public WaterLevel basicGetLowLevelLimit() {
		return lowLevelLimit;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setLowLevelLimit(WaterLevel newLowLevelLimit) {
		WaterLevel oldLowLevelLimit = lowLevelLimit;
		lowLevelLimit = newLowLevelLimit;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ProductionPackage.TARGET_LEVEL_SCHEDULE__LOW_LEVEL_LIMIT, oldLowLevelLimit, lowLevelLimit));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case ProductionPackage.TARGET_LEVEL_SCHEDULE__HIGH_LEVEL_LIMIT:
				if (resolve) return getHighLevelLimit();
				return basicGetHighLevelLimit();
			case ProductionPackage.TARGET_LEVEL_SCHEDULE__LOW_LEVEL_LIMIT:
				if (resolve) return getLowLevelLimit();
				return basicGetLowLevelLimit();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case ProductionPackage.TARGET_LEVEL_SCHEDULE__HIGH_LEVEL_LIMIT:
				setHighLevelLimit((WaterLevel)newValue);
				return;
			case ProductionPackage.TARGET_LEVEL_SCHEDULE__LOW_LEVEL_LIMIT:
				setLowLevelLimit((WaterLevel)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case ProductionPackage.TARGET_LEVEL_SCHEDULE__HIGH_LEVEL_LIMIT:
				setHighLevelLimit((WaterLevel)null);
				return;
			case ProductionPackage.TARGET_LEVEL_SCHEDULE__LOW_LEVEL_LIMIT:
				setLowLevelLimit((WaterLevel)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case ProductionPackage.TARGET_LEVEL_SCHEDULE__HIGH_LEVEL_LIMIT:
				return highLevelLimit != null;
			case ProductionPackage.TARGET_LEVEL_SCHEDULE__LOW_LEVEL_LIMIT:
				return lowLevelLimit != null;
		}
		return super.eIsSet(featureID);
	}

} //TargetLevelScheduleImpl
